Raise an exception in xm_block_detach if using Xen-API and it fails -- this
authorEwan Mellor <ewan@xensource.com>
Tue, 20 Mar 2007 17:36:18 +0000 (17:36 +0000)
committerEwan Mellor <ewan@xensource.com>
Tue, 20 Mar 2007 17:36:18 +0000 (17:36 +0000)
ensures that the exit status properly set.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
tools/python/xen/xm/main.py

index a138afdd9592f1fc0fcb8510eeef7210f772694b..66a5951f7f5024e03ec224c60c6ab511f1609d40 100644 (file)
@@ -1962,7 +1962,8 @@ def xm_block_detach(args):
             if len(server.xenapi.VDI.get_VBDs(vdi_ref)) <= 0:
                 server.xenapi.VDI.destroy(vdi_ref)
         else:
-            print "Cannot find device '%s' in domain '%s'" % (dev,dom)
+            raise OptionError("Cannot find device '%s' in domain '%s'"
+                              % (dev,dom))
     else:
         try:
             detach(args, 'block-detach', 'vbd')